from selenium.webdriver.common.by import By
from selenium import webdriver
from time import sleep
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
driver=webdriver.Chrome()
driver.get("http://192.168.1.12/ranzhi/www/sys/user-login.html")
sleep(2)
from selenium.webdriver.common.by import By
WebDriverWait(driver,2).until(expected_conditions.presence_of_element_located((By.NAME,"account")))
driver.find_element(By.NAME,"account").send_keys("admin")
WebDriverWait(driver,2).until(expected_conditions.presence_of_element_located((By.NAME,'password')))
driver.find_element(By.NAME,'password').send_keys('123456')
WebDriverWait(driver,2).until(expected_conditions.element_to_be_clickable((By.ID,"submit")))
driver.find_element(By.ID,"submit").click()
sleep(10)
assert_href = driver.find_element(By.XPATH, '//*[@id="s-menu-1"]/button/img').get_attribute("src")
sleep(5)
print('------------------')
print(assert_href)
# assert assert_href=="/ranzhi/www/theme/default/images/ips/app-crm.png",'登录失败'
sleep(2)
# assert_text=driver.find_element(By.XPATH,'//*[@id="mainNavbar"]/ul/li[1]/a').text
#
# assert assert_text=="首页"
sleep(5)